your personal website on atproto - mirror
blento.app
1import { getRecord } from '$lib/atproto/methods.js';
2import type { Did } from '@atcute/lexicons';
3import { getActor } from '$lib/actor.js';
4
5export async function load({ params, platform, request }) {
6 const did = await getActor({ request, paramActor: params.actor, platform });
7
8 if (!did) return { accentColor: undefined, baseColor: undefined };
9
10 try {
11 const publication = await getRecord({
12 did: did as Did,
13 collection: 'site.standard.publication',
14 rkey: 'blento.self'
15 });
16
17 const preferences = publication?.value?.preferences as
18 | { accentColor?: string; baseColor?: string }
19 | undefined;
20
21 return {
22 accentColor: preferences?.accentColor,
23 baseColor: preferences?.baseColor
24 };
25 } catch {
26 return { accentColor: undefined, baseColor: undefined };
27 }
28}